<template>
	<view :style="bodyStyle">
		<view class="flex-col-center">
			<image class="hw128 round"  :src="logoImg" ></image>
			<view class="font-s48 margin-top-32 text-bold">
				<text class="text-purple">Ole Chat</text>
				<text class="margin-left-5">管理后台</text>
			</view>
			<view class="margin-top-16">
				<up-loadmore status="loading" fontSize="18" iconSize="31" color="#CFCFCF"/>
			</view>
		</view>
	</view>
</template>
<script setup lang="ts">
import { onShow  } from "@dcloudio/uni-app"
import { reactive } from 'vue'
import { urls } from '@/security/paths'
import { redirectTimeout, switchTab } from '@/security/router'
import { useAuthStore }  from "@/store"

const authStore = useAuthStore()

import logoImg from "@/static/logo.png"

const windowInfo = uni.getWindowInfo()
const screenHeight = windowInfo.screenHeight
const bodyStyle = reactive<any>({
    paddingTop: Math.floor(screenHeight * 0.1) + 'px',
    width: '100%'
}) 

onShow( async ()=>{
	await authStore.flushLogin().then(res => {
        if(!res){
			redirectTimeout(urls.Loin)
		}else{
			switchTab(urls.Anchor)
		}
	}).catch( () => {
        redirectTimeout(urls.Loin)
	})
})	

</script>